<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
 * Created by CodeTlan.
 * User: Ing. Miguel Salas
 * Date: 3/25/12
 * Time: 1:20 AM
 */
class Permiso extends CT_Model
{
    function __construct()
    {
        parent::__construct();
        $this->table = 'CT_modulos_permisos';
    }

    function find($data)
    {
        $this->db->select('
            MP.modulo_k,
            MP.accion_k,
            M.titulo,
            M.img_big,
            X.accion_k as permiso,
            X.permiso_k
        ');
        $this->db->from('CT_modulos_permisos MP');
        $this->db->join('CT_modulos M', 'MP.modulo_k=M.modulo_k');
        $this->db->join('CT_modulos_permisos X', 'X.accion_k=MP.accion_k AND X.rol_k=' . $data["rol_k"] . ' AND X.estatus = 1', 'left');
        $this->db->where('MP.rol_k = ' . $data["rol_session"]);
        $this->db->where('MP.estatus = 1');
        $query = $this->db->get();
        return $query->result();
    }
}
